#!/usr/bin/env python3
"""
智能异常处理系统服务器启动脚本
"""

import uvicorn
from fastapi import FastAPI
from agent_mcp.app.routes import router

# 创建FastAPI应用
app = FastAPI(
    title="智能异常处理系统",
    description="基于置信度判断的智能异常处理系统",
    version="1.3.0"
)

# 注册路由
app.include_router(router, prefix="/api")

@app.get("/")
async def root():
    """根路径，返回系统信息"""
    return {
        "message": "智能异常处理系统",
        "version": "1.3.0",
        "status": "running",
        "endpoints": {
            "process_anomaly": "/api/intelligent/process_llm_analysis"
        }
    }

@app.get("/health")
async def health_check():
    """健康检查接口"""
    return {
        "status": "healthy",
        "timestamp": "2025-01-27T06:01:36"
    }

if __name__ == "__main__":
    print("启动智能异常处理系统...")
    print("API文档地址: http://localhost:8000/docs")
    print("健康检查: http://localhost:8000/health")
    print("异常处理接口: http://localhost:8000/api/intelligent/process_llm_analysis")
    
    # 启动服务器
    uvicorn.run(
        "start_server:APP",
        host="0.0.0.0",
        port=8000,
        reload=True,
        log_level="info"
    ) 